package com.wxy.controller;

import com.wxy.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;

/**
 * @Author Administrator
 * @Description TODO
 * @Date 2021/3/2 13:50
 * @Version 1.0
 * @desc
 */
@RestController
public class EmailController {
    @Autowired
    private EmailService emailService;

    @ResponseBody
    @RequestMapping(value = "/stringEmaile",method = RequestMethod.GET)
    public String sendStringEmail(){
        emailService.sendStringEmail("2138942661@qq.com","作业","我完成了");
        return "发送成功";
    }

    @ResponseBody
    @RequestMapping(value = "/bigEmaile",method = RequestMethod.GET)
    public String sendBigEmail(){
        File file = new File("src/main/resources/static/zong.jpg");
        emailService.sendBigEmail("1939841042@qq.com","你好，美图请查收","看我拍的咋样？",file);
        return "发送成功";
    }

    @ResponseBody
    @RequestMapping(value = "/templateEmail",method = RequestMethod.GET)
    public String sendTemplateEmail(){
        //emailService.sendTemplateEmail("mmmmmm@qq.com","激活邮件","freemarkerTemplate.html");
        emailService.sendTemplateEmail("1939841042@qq.com","激活邮件","thymeleafTemplate.html");
        return "发送成功";
    }
}
